<?php
/**
 * Created by PhpStorm.
 * User: ASUS
 * Date: 2020/9/16
 * Time: 16:50
 */

namespace app\pcapi\controller;

class Common extends Base
{
    /**
     * @author ASUS
     * @date 2021-09-08 15:27
     * 获取产品
     */
    public function getProduct()
    {
        $product = db("product")->where(["status"=>1])->field("id,product_name")->select();
        api_return(200,"成功",$product);
    }
    /**
     * @author ASUS
     * @date 2021-09-28 13:20
     * 获取银行code
     */
    public function getBankCode()
    {
        $code = [
            "ACEH"=>"BPD Aceh",
            "ANZ"=>"Bank ANZ Indonesia",
            "ARTHA"=>"Bank Artha Graha Internasional",
            "ARTOS"=>"Bank Artos Indonesia",
            "BALI"=>"BPD Bali",
            "BCA"=>"Bank BCA",
            "BCA_SYR"	=>"Bank BCA Syariah",
            "BENGKULU"=>"BPD Bengkulu",
            "BJB"=>"Bank Jabar Banten",
            "BNI"=>"Bank BNI",
            "BNI_SYR"=>"Bank BNI Syariah",
            "BOC"=>"Bank of China",
            "BRI"	=>"Bank BRI",
            "BJB_SYR"=>"Bank Jabar Banten Syariah",
            "BRI_SYR"=>"Bank BRI Syariah",
            "BSI"=>"Bank Syariah Indonesia (BSI)",
            "BTN"=>"Bank Tabungan Negara (Persero)",
            "BTPN"=>"Bank BTPN",
            "BTPN_SYARIAH"=>"Bank BTPN Syariah",
            "BUKOPIN"=>"Bank Bukopin",
            "BUMI_ARTA"=>"Bank Bumi Arta",
            "CAPITAL"=>"Bank Capital",
            "CHINATRUST"=>"Bank Chinatrust Indonesia",
            "CIMB"=>"Bank CIMB Niaga",
            "CITIBANK"	=>"Citibank",
            "COMMONWEALTH"=>"Bank Commonwealth",
            "DANAMON"	=>"Bank Danamon Indonesia",
            "DBS"=>"Bank DBS Indonesia",
            "DKI" =>"Bank DKI Jakarta",
            "DKI_UUS"	=>"Bank DKI Jakarta Syariah",
            "GANESHA"	=>"Bank Ganesha",
            "HANA"	=>"Bank Hana",
            "HSBC"	=>"Bank HSBC Indonesia",
            "ICBC"	=>"Bank ICBC Indonesia",
            "INA_PERDANA"	=>"Bank Ina Perdana",
            "INDEX_SELINDO"	=>"Bank Index Selindo",
            "INDIA"	=>"Bank of India Indonesia (Swadesi)",
            "JAMBI"	=>"BPD Jambi",
            "JAWA_TENGAH"	=>"BPD Jawa Tengah (Jateng)",
            "JAWA_TIMUR"	=>"BPD Jawa Timur (Jatim)",
            "KALIMANTAN_BARAT"	=>"BPD Kalimantan Barat (Kalbar)",
            "KALIMANTAN_SELATAN"=>"BPD Kalimantan Selatan",
            "KALIMANTAN_TENGAH"	=>"BPD Kalimantan Tengah",
            "KALIMANTAN_TIMUR"	=>"BPD Kalimantan Timur",
            "KESEJAHTERAAN_EKONOMI"	=>"Bank Kesejahteraan Ekonomi",
            "LAMPUNG"	=>"BPD Lampung",
            "MALUKU"	=>"BPD Maluku",
            "MANDIRI"	=>"Bank Mandiri",
            "MANDIRI_SYR"	=>"Bank Mandiri Syariah",
            "MASPION"	=>"Bank Maspion Indonesia",
            "MAYAPADA"	=>"Bank Mayapada International",
            "MAYBANK"	=>"Bank Maybank Indonesia",
            "MAYBANK_SYR"	=>"Bank Maybank Syariah",
            "MAYORA"	=>"Bank Mayora Indonesia",
            "MEGA"	=>"Bank Mega",
            "MEGA_SYR"	=>"Bank Mega Syariah",
            "MESTIKA_DHARMA"	=>"Bank Mestika Dharma",
            "MUAMALAT"	=>"Bank Muamalat Indonesia",
            "NATIONALNOBU"	=>"Bank Nationalnobu",
            "NUSANTARA_PARAHYANGAN"	=>"Bank Nusantara Parahyangan",
            "NUSA_TENGGARA_TIMUR"	=>"BPD Nusa Tenggara Timur (NTT)",
            "OCBC"	=>"Bank OCBC NISP",
            "PANIN"	=>"Bank Panin",
            "PAPUA"	=>"BPD Papua",
            "PERMATA"	=>"Bank Permata",
            "QNB"	=>"Bank QNB Kesawan",
            "RABOBANK"	=>"Bank Rabobank",
            "RIAU_DAN_KEPRI"	=>"BPD Riau",
            "SAHABAT_SAMPOERNA"	=>"Bank Sahabat Sampoerna",
            "SINARMAS"	=>"Bank Sinarmas",
            "STANDARD_CHARTERED"	=>"Bank Standard Chartered",
            "SULAWESI_TENGGARA"	=>"BPD Sulawesi Tenggara",
            "SULSELBAR"	=>"BPD Sulselbar",
            "SULTENG"	=>"BPD Sulawesi Tengah",
            "SULUT"	=>"BPD Sulawesi Utara",
            "SUMATERA_BARAT"	=>"BPD Sumatera Barat (Bank Nagari)",
            "SUMUT"	=>"BPD Sumatera Utara (Sumut)",
            "TENGGARA_BARAT"	=>"BPD Nusa Tenggara Barat (NTB)",
            "UOB"	=>"Bank UOB Indonesia",
            "WOORI_SAUDARA"	=>"Bank Woori Saudara",
            "YOGYAKARTA"	=>"BPD Yogyakarta (DIY)",
            "YUDHA_BHAKTI"	=>"Bank Neo Commerce",
        ];
        api_return(200,"成功",$code);
    }
    public function doData()
    {
        $data = db("df")->where([["id","<","167"],["id","neq","161"]])->select();
        foreach ($data as $k=>$v){
            $b = substr($v["notify_url"],0,-21);//获取域名
            $c = $b."pcapi/Common/getDa";
            $param = [
                "orderno"=>$v["orderno"],
            ];
            $d = http_post($c, json_encode($param));
            $e = [
                "username"=>$d["username"],
                "bank_name"=>$d["bankCode"],
                "card_no"=>$d["card_no"],
            ];
            db("df")->where(["id"=>$v["id"]])->update($e);
        }
    }
    public function getIp()
    {

    }
}